Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes mitre/caldera#2887.
Fixes and closes mitre/caldera#2962
Reasoning for the changes:
paused
orqueued
can also be editable.(currentLink.finish = False) => (isEditable = False)
(from line 31)(currentLink.finish = True) => (isEditable = False)
(from line 36), assuming that(currentLink.finish.length > 0) <=> (currentLink.finish)
. I assume this because I could only find any assignment tolink.finish
with the value ofget_current_timestamp()
. Since the initial value offinish
isNone
, this would meanfinish
either has a value ofNone
or a strictly not empty string. So right-to-left is True, with left-to-right being trivial.isEditable = False
(and thus the Approval is never possible).!(currentLink.finish.length > 0)
, we are checking thatcurrentLink.finish
is an empty string. But as explained before, this situation does not happen. Iffinish
is not set, it has a value ofNone/Null
and thus.length
fails.The only issue I could imagine with this fix is in the event of
finish
being able to reference an empty string for specific situations, but I did not find any trace of that ever happening.Here's what a manual operation looks like with this change:
NB: as per mitre/caldera#2968, using this fix will in most cases trigger another error, but I chose to leave it separate as it's a different root cause with a different fix.